﻿@{
    ViewBag.Title = "SteelIndex";
}
@section head
{
    <link href="@Url.Content("~/ScriptPlugin/easyui/themes/gray/easyui.css")" rel="stylesheet" />
    <link href="@Url.Content("~/ScriptPlugin/easyui/themes/icon.css")" rel="stylesheet" />
    <script type="text/javascript" src="@Url.Content("~/ScriptPlugin/easyui/jquery.easyui.min.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/ScriptPlugin/easyui/locale/easyui-lang-zh_CN.js")"></script>
    <script type="text/javascript" src="@Url.Content("~/Scripts/KingsSharp.DataGrid.Filter.js")"></script>
    <script src="@Url.Content("~/ScriptPlugin/WdatePicker/js/WdatePicker.js")"></script>
}
<div id="grid">
    <div id="toolpannel">
        <div class="content-pannel-buttons">
            <a><b class="p-icon-reload">刷新 </b></a>
            @if (ViewBag.createSteelgarent)
            {
                <a onclick="SteelAdd()">
                    <b class="p-icon-add">
                        新增
                    </b>
                </a>
            }
            @if (ViewBag.updateSteelgarent)
            {
                <a onclick="SteelEdit()"><b class="p-icon-edit">编辑</b></a>
            }
          @if (ViewBag.deleteSteelgarent)
          {
            <a onclick="SteelDelete()"><b class="p-icon-delete">删除</b></a>
          }
            <a onclick="$('#grid').datagrid('load')">
                <b class="p-icon-serch">查询</b>
            </a>
        </div>
        <div class="datagrid-filter-pannel" id="filterpannel">
            <table class="content-table-serch">
                <tr>
                    <th>
                        钢厂名称
                    </th>
                    <td>
                        <input type="text" name="Name" data-filter="true" />
                        <a class="p-icon-filter p-icon-filter-style" style="display: block; width: 22px;
                            height: 22px; float: left">@Html.GetFilterItem("Name", typeof(string))</a>
                        </td>
                        <th>
                            
                        </th>
                        <td>
                            
                        </td>
                        <th>
                            
                        </th>
                        <td></td>
                        <th>

                        </th>
                        <td></td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
    @section foot{
        <script type="text/javascript">
    function LoadSteelData()
    {
        var columns = [[
                { field: "ck", checkbox: true },
                { field: "Name", title: "钢厂名称",width:130}
            ]];
            var parameter = {
            title: "@Html.GetGridTitle("系统管理","钢厂档案维护")",
            columns: columns,
            url: "@Url.Content("~/Customer/Steel/GetSteelGridData")",
            pageNumber: 1
        };
        var grid = K.GetGridData("#grid", parameter).Grid;
    }
    LoadSteelData();

    function SteelAdd()
    {
        K.layer.iframe({
            title: "@Html.GetLayerTitle(LayerIcon.Add,"新增顾客")",
            content: "@Url.Content("~/Customer/Steel/SteelAdd")",
            maxmin: true,
            initfull: true,
            btn:["保存","返回"],
            callback:function(result)
            {
                if (K.ShowOrAlert(result))
                {
                    $("#grid").datagrid("load");
                }
            }
        });
    }
    function SteelEdit(userid)
    {
        var row = $("#grid").datagrid("getSelected");
        if (row == null)
        {
            K.Alert("请选择需编辑的行");
            return false;
        }
        K.layer.iframe({
            title: "@Html.GetLayerTitle(LayerIcon.Edit,"编辑顾客")",
            content: "@Url.Content("~/Customer/Steel/SteelEdit")?SteelId=" + row.Id,
            maxmin: true,
            initfull: true,
            btn: ["保存", "返回"],
            callback: function (result) {
                if (K.ShowOrAlert(result)) {
                    $("#grid").datagrid("load");
                }
            }
        });
    }
    function SteelDelete()
    {
        var row = $("#grid").datagrid("getSelected");
        if (row == null) {
            K.Alert("请选择需删除的钢厂");
            return false;
        }
        K.Confirm("确认删除钢厂 \"" + row.Name + "\" ？", function () {
            K.AjaxJson("@Url.Content("~/Customer/Steel/SteelDelete")", { SteelId: row.Id, SteelName: row.Name }, function (result) {
                if (K.ShowOrAlert(result)) {
                    $("#grid").datagrid("load");
                }
            }, "钢厂 \"" + row.Name + "\"删除中...");
        });
    }
        </script>

    }